<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>关联供应商</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<script type="text/javascript">
    var grid = null;
    var prjId = '${prjId}';
    $(function () {
        initForm();
        initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
        searchBtnEvent();
        clearBtnEvent();
    });

    //清空按钮事件
    function clearBtnEvent() {
        $("#clearBtn").click(function (event) {
            var form = liger.get("searchBar");
            form.setData({
                "splNm": " "
            });
        });
    }

    //初始化表单
    function initForm() {
        $("#searchBar").ligerForm();
    }

    //查询按钮事件
    function searchBtnEvent() {
        $("#searchBtn").click(function (event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            data["crtTm"] = $("#crtTm").val();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            ;
            grid.reload();
        });
    }

    //初始化列表
    function initGrid() {
        var splNm = $("#splNm").val();
        var audStsCdList = new Array();
        audStsCdList.push(CommonConstant.C_AUD_PASS_CODE);
        var audStsCdListArr = JSON.stringify(audStsCdList);
        $("#ligergrid1").ligerGrid({
            url: '<%=path%>/project/prjprdbscinfo/splInitList.do?audStsCdList='+audStsCdListArr+'&prjId='+prjId,
            method: 'get',
            parms: {splNm:splNm},
            columns: [
                { display: '供应商名称', name: 'splNm',minWidth: 150 },
                { display: '企业性质', name: 'corpTypCdNm', minWidth: 100 },
                { display: '经营范围', name: 'bizScope', minWidth: 150 },
                { display: '注册资本', name: 'regCapAmt', minWidth: 50 },
                { display: '实收资本', name: 'paidCapAmt', minWidth: 50 },
                { display: '操作', isSort: false, width: 100,
                    render: function (rowdata, rowindex, value) {
                        var h = '<a class="sq-button-hasicon" href="javascript:chooseSplRow(';
                        h += "'" + rowdata.id + "',";
                        h += "'" + rowdata.splNm + "',";
                        h += "'" + rowdata.splStarLevel + "',";
                        h += "'" + rowdata.rcCstBscInfoId + "'";
                        h += ')"><i class="sqBtnIco_3"></i>选择</a>'
                        return h;
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            usePagerOnLessPagesize: false,
            isSingleCheck: true,
            rownumbers: true,

        });
        grid = liger.get("ligergrid1");
        grid.setHeight(100);
    }


    function clearBtn() {
        var form = new liger.get("searchBar");
        form.clear();
    }

    function iframeResize() {
        if (parent.mainApp) {
            parent.mainApp.parentTab.onResize();
        }
        ;
    }
    function chooseSplRow(id, name, splStarLevel,rcCstBscInfoId) {
        //需要新增星级
        var combo_DATA = {"id":id,"name":name,"splStarLevel":splStarLevel,"rcCstBscInfoId":rcCstBscInfoId};
        if(frameElement && frameElement.dialog) {
            frameElement.dialog.set("_spl", combo_DATA); //给父窗口的dialog传参
            frameElement.dialog.close();
        }
    }
</script>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">供应商名称</div>
                    <div class="field">
                        <input name="splNm" id="splNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</div>
</body>
</html>